package com.llp.declaresystem.mapper;

import com.llp.declaresystem.domain.entity.Unit;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
* @author NASK
* @description 针对表【unit(单位信息表)】的数据库操作Mapper
* @createDate 2022-11-23 16:22:50
* @Entity com.llp.declaresystem.entity.Unit
*/
@Mapper
public interface UnitMapper extends BaseMapper<Unit> {
    /**
     * 通过uid查询用户信息
     * @param uid
     * @return
     */
    @Select("select * from unit where uid=#{uid}")
    Unit selectByUid(Integer uid);

    /**
     * 通过unitid查询用户信息
     * @param unitId
     * @return
     */
    @Select("select * from unit where unitid=#{unitId}")
    Unit selectByUnitid(Integer unitId);

    /**
     * 根据uid进行更新操作
     * @param unit
     * @return
     */
    @Update("update unit set unitname=#{unitname},address=#{address},corporation=#{corporation},"
            +"investment=#{investment},type=#{type},tel=#{tel},email=#{email},fax=#{fax},zipcode=#{zipcode},introduction=#{introduction} where uid=#{uid}")
    int updateByUid(Unit unit);

    /**
     * 根据unitid进行删除操作
     * @param id
     */
    @Delete("delete from unit where unitid = #{id}")
    void deleteById(Integer id);
}




